package com.yvdelx.cyclowomen.utility;

import android.app.Activity;

import java.text.DecimalFormat;

/**
 * String utilities
 * Created by ydelvaux on 22/02/14.
 */
public class StringUtility {

    /*
       Presentation items
    */
    public static final String CST_DATE = "date";

    public static final String CST_BUNDLE = "bundle";

    public static final String CST_IS_MODIFICATION = "is modification";

    /*
        Connectors items
     */
    public static final String CST_XML_PATH_SEPARATOR = "/";

    public static final String CST_XML_PATH_DIRECTORY = CST_XML_PATH_SEPARATOR +
            "Android" +
            CST_XML_PATH_SEPARATOR +
            "data" +
            CST_XML_PATH_SEPARATOR +
            "com.yvdelx.cyclowoman";

    public static final String CST_XML_PATH_FILENAME = "cyclowoman.xml";

    public static final String CST_XML_PATH_COMPLETE =
            CST_XML_PATH_DIRECTORY + CST_XML_PATH_SEPARATOR + CST_XML_PATH_FILENAME;

    public static final String CST_XML_DATA_CYCLE_ELEMENT = "Cycle";

    public static final String CST_XML_DATA_ID_ATTRIBUTE = "ID";

    public static final String CST_XML_DATA_DAY_ELEMENT = "Day";

    public static final String CST_XML_DATA_DATE_ELEMENT = "Date";

    public static final String CST_XML_DATA_TEMPERATURE_ELEMENT = "Temperature";

    public static final String CST_XML_DATA_NOMINAL_CONDITION_ELEMENT = "IsNominalCondition";

    public static final String CST_XML_DATA_SENSATION_ELEMENT = "Sensation";

    public static final String CST_XML_DATA_QUANTITY_ELEMENT = "Quantity";

    public static final String CST_XML_DATA_NATURE_ELEMENT = "Nature";

    public static final String CST_XML_DATA_COMMENT_ELEMENT = "Comment";

    public static final String CST_XML_DATA_PROFILE_ELEMENT = "Profile";

    public static final String CST_XML_DATA_NAME_ATTRIBUTE = "Name";

    public static final String CST_XML_DATA_FIRSTNAME_ATTRIBUTE = "Firstname";

    public static final String CST_XML_DATA_DATE_DEBUT_ATTRIBUTE = "DateDebut";

    public static final String CST_XML_DATA_DATE_FIN_ATTRIBUTE = "DateFin";

    public static final String CST_XML_DATA_CURRENT_CYCLE = "CurrentCycle";


    /*
        Colors
     */

    public static final String CST_COLOR_BLUE = "BLUE";

    public static final String CST_COLOR_ORANGE = "ORANGE";

    public static final String CST_COLOR_GREEN = "GREEN";

    public static final String CST_COLOR_RED = "RED";

    public static final String CST_COLOR_WHITE = "WHITE";

    public static final String CST_COLOR_GREY = "GREY";

    public static final String CST_COLOR_CURRENT_DATE = "CURRENT_DATE";



    /*
        Methods
     */

    private static DecimalFormat decimalFormat = new DecimalFormat("#.##");

    /**
     * Method to compare two strings
     * @param str1 String
     * @param str2 String
     * @return Boolean
     */
    public static boolean compareStrings(String str1, String str2){
       return str1.compareTo(str2) == 0;
    }

    /**
     * Method to format double to string
     * @param value Double
     * @return String
     */
    public static String formatDouble(double value){
        return decimalFormat.format(value);
    }

    /**
     * Get the string resource
     * @param index Integer
     * @param activity Activity
     * @return String
     */
    public static String getStringResource(Integer index, Activity activity){
        return activity.getResources().getString(index);
    }
}
